﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Model;

namespace BLL.UsersTransaction
{
    public class UserLoginTransaction : QueryUsersTransaction
    {
        public enum LoginResult
        { 
            成功,
            失败
        }

        public UserLoginTransaction(string _LoginName, string _UserPassword)
        {
            this.loginName = _LoginName;
            this.userpassword = _UserPassword;
        }

        private string loginName;
        private string userpassword;

        public LoginResult LoginState
        {
            get
            {
                base.Execute();
                T_UserObject  resultUser = base.Users.SingleOrDefault(x => x.Db_LoginName == loginName );
                if (resultUser != null)
                {
                    if (resultUser.Db_Password == userpassword)
                    {
                        return LoginResult.成功;
                    }
                }
                return LoginResult.失败;
            }
        }

    }
}
